<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>搜索结果</title>
  <style>
    body, html {
      margin: 0;
      padding: 0;
      font-family: Arial, sans-serif;
    }
    .header {
      background-color: #007BFF;
      color: white;
      padding: 10px;
      text-align: center;
    }
    .sidebar {
      width: 200px;
      background-color: #f8f9fa;
      float: left;
      height: 100vh;
      padding-top: 20px;
    }
    .sidebar a {
      display: block;
      padding: 10px;
      text-decoration: none;
      color: black;
    }
    .sidebar a:hover {
      background-color: #ddd;
    }
    .content {
      margin-left: 210px;
      padding: 20px;
    }
    /*body {*/
    /*  font-family: 'Arial', sans-serif;*/
    /*  background-color: #f4f4f9;*/
    /*  color: #333;*/
    /*  margin: 0;*/
    /*  padding: 0;*/
    /*}*/
    h1 {
      text-align: center;
      color: #4CAF50;
      margin-top: 20px;
    }
    .container {
      max-width: 90%;
      margin: 50px auto;
      padding: 20px;
      background-color: #fff;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
      border-radius: 8px;
    }
    .back-button {
      display: block;
      width: 100px;
      margin: 20px auto;
      padding: 10px;
      text-align: center;
      background-color: #4CAF50;
      color: white;
      text-decoration: none;
      border-radius: 5px;
    }
    .back-button:hover {
      background-color: #45a049;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 20px;
    }
    th, td {
      padding: 12px;
      text-align: left;
      border-bottom: 1px solid #ddd;
    }
    th {
      background-color: #f2f2f2;
    }
    tr:hover {
      background-color: #f5f5f5;
    }
    p {
      text-align: center;
      margin-top: 20px;
    }
  </style>
</head>
<body>
<jsp:include page="/nav.jsp"/>
<div class="container">
  <a href="buildingList" class="back-button">返回搜索</a> <!-- 返回按钮 -->
  <h1>搜索结果</h1>
  <c:if test="${not empty searchResults}">
    <table>
      <tr>
        <th>ID</th>
        <th>名称</th>
        <th>地址</th>
      </tr>
      <c:forEach var="building" items="${searchResults}">
        <tr>
          <td>${building.buildingID}</td>
          <td>${building.buildingName}</td>
          <td>${building.address}</td>
        </tr>
      </c:forEach>
    </table>
  </c:if>
  <c:if test="${empty searchResults}">
    <p>没有找到匹配的结果。</p>
  </c:if>
</div>
</body>
</html>